if (typeof window != 'undefined') {
	if (window.gom === undefined) {
		window.gom = {};
	}
} else {
	if (!gom) {
		gom = {};
	}
}

gom.common = new Object();

gom.common.Window = jindo.$Class({
	$static : {
		windowResize : function () {
			var height = window.document.body.scrollHeight;
			var width  = window.document.body.scrollWidth;
			var winWidth	 = window.screen.width;
			var winHeight = window.screen.height;
			if(winHeight < height || winWidth < width) {
				document.body.style.overflow = 'scroll';
			}else {
				document.body.style.overflow ='hidden';
			}
			var ua = navigator.userAgent;
			if ( ua.indexOf("MSIE") != -1 ) {
				window.resizeBy(width-document.body.clientWidth, height-document.body.clientHeight);
			} else {
				window.resizeBy(width-window.innerWidth, height-window.innerHeight);
			}
		},
		openPopup : function (url, name, scroll, resize, top, left, width, height) {
			var staticOption = "toolbar=no,location=no,status=no,menubar=no,";
			var option = "scrollbars="+ scroll + ",resizable="+ resize + ",top="+ top + ",left=" + left + ",width=" + width + ",height=" + height;
			window.open(url, name, staticOption + option);
			staticOption = null;
			option = null;
		}
	}
});



/*
Example ;;

shop.luckytoday2 = new Object();


shop.luckytoday2.catalog = new Object();


shop.luckytoday2.catalog.Utility = new jindo.$Class({

	$static : {

		countWeeksInMonth : function(htDate) {
			var htFirstWeek = shop.luckytoday2.catalog.Utility.getDateForMondayIndexInfo(htDate, 1);
			var nLastDate = jindo.Calendar.getLastDate(htDate.nYear, htDate.nMonth);
			return Math.ceil((nLastDate - htFirstWeek.nDate + 1) / 7);
		},

		isSelectableMonth : function(htDate) {
			var htSecondWeek = DateCoreAPI.getDateForIndexInfo(htDate.nYear, htDate.nMonth, 0, { "order" : 2, "day" : 1 });
			return !jindo.Calendar.isPast(htDate, htSecondWeek);
		},

		getLastWeekAtPrevMonth : function(htDate) {
			htPrevDate = jindo.Calendar.getRelativeDate(0, -1, 0, htDate);
			return DateCoreAPI.getDateForLastDay(htPrevDate.nYear, htPrevDate.nMonth, 0, 1);
		},

		getDateForMondayIndexInfo : function(htDate, nOrder) {
			return shop.luckytoday2.catalog.Utility.getDateForIndexInfo(htDate, nOrder, 1);
		},

		getDateForIndexInfo : function(htDate, nOrder, nDayIndex) {
			return DateCoreAPI.getDateForIndexInfo(htDate.nYear, htDate.nMonth, 0, { "order" : nOrder, "day" : nDayIndex });
		}

	}

});


shop.luckytoday2.catalog.HeadlineDate = new jindo.$Class({

	tHeadLineItem : jindo.$Template('<span class="lucky_num lucky_num{=digit}">{=digit}</span>&nbsp;'),
	elHeadLine : null,

	$init : function(sHeadlineDateLayerId, htDate) {
		this.elHeadLine = jindo.$Element(sHeadlineDateLayerId);
		this.initializeHeadLine(htDate);
	},

	initializeHeadLine : function(htDate) {
		var sYear = String(htDate.nYear);
		for (var i = 0; i < 4; i++) {
			this.elHeadLine.appendHTML(this.tHeadLineItem.process({ "digit" : sYear.charAt(i)}));
		}
		this.elHeadLine.appendHTML('<span class="lucky_num lucky_numdot">년</span>&nbsp;');

		var sMonth = DateCoreAPI.getTwoDigit(htDate.nMonth);
		for (var i = 0; i < 2; i++) {
			this.elHeadLine.appendHTML(this.tHeadLineItem.process({ "digit" : sMonth.charAt(i)}));
		}
		this.elHeadLine.appendHTML('<span class="lucky_num lucky_numdot">월</span>&nbsp;');

		var sDate = DateCoreAPI.getTwoDigit(htDate.nDate);
		for (var i = 0; i < 2; i++) {
			this.elHeadLine.appendHTML(this.tHeadLineItem.process({ "digit" : sDate.charAt(i)}));
		}
		this.elHeadLine.appendHTML('<span class="blind">일</span>');
	}

});


shop.luckytoday2.catalog.MonthCalendar = new jindo.$Class({

	tMonthItem : jindo.$Template('<span class="num num{=digit}">{=digit}</span>'),
	tMonthLink : null,
	elMonthCalendar : null,
	htTodayDate : null,

	$init : function(sMonthCalendarLayerId, htTodayDate, htServiceDate, sMonthLink) {
		this.elMonthCalendar = jindo.$Element(sMonthCalendarLayerId);
		this.tMonthLink = jindo.$Template(sMonthLink);
		this.htTodayDate = htTodayDate;
		this.initializeMonthCalendar(htServiceDate);
	},

	initializeMonthCalendar : function(htDate) {
		var sYear = String(htDate.nYear);
		for (var i = 0; i < 4; i++) {
			this.elMonthCalendar.appendHTML(this.tMonthItem.process({ "digit" : sYear.charAt(i)}));
		}
		this.elMonthCalendar.appendHTML('<span class="num dot">.</span>');

		var sMonth = DateCoreAPI.getTwoDigit(htDate.nMonth);
		for (var i = 0; i < 2; i++) {
			this.elMonthCalendar.appendHTML(this.tMonthItem.process({ "digit" : sMonth.charAt(i)}));
		}

		var htPrevDate = this.getPreviousMonth(htDate);
		var sPrevUrl = this.tMonthLink.process({ "yyyy" : htPrevDate.nYear, "mm" : DateCoreAPI.getTwoDigit(htPrevDate.nMonth), "dd" :  DateCoreAPI.getTwoDigit(htPrevDate.nDate) });
		this.elMonthCalendar.appendHTML('<a href="' + sPrevUrl + '" class="btn prev" title="이전달 보기">이전달 보기</a><!--N=a:tit.prev-->');

		if (this.hasFutureMonth(htDate)) {
			var htNextDate = this.getNextMonth(htDate);
			var sNextUrl = this.tMonthLink.process({ "yyyy" : htNextDate.nYear, "mm" : DateCoreAPI.getTwoDigit(htNextDate.nMonth), "dd" :  DateCoreAPI.getTwoDigit(htNextDate.nDate) });
			this.elMonthCalendar.appendHTML('<a href="' +  sNextUrl + '" class="btn next" title="다음달 보기">다음달 보기</a><!--N=a:tit.next-->');
		}
	},

	getPreviousMonth : function(htDate) {
		var nYear = htDate.nYear;
		var nMonth = htDate.nMonth;
		if (nMonth == 1) {
			nMonth = 12;
			nYear = nYear - 1;
		} else {
			nMonth = nMonth - 1;
		}
		return DateCoreAPI.getDateForLastDay(nYear, nMonth, 0, 1);
	},

	getNextMonth : function(htDate) {
		var nYear = htDate.nYear;
		var nMonth = htDate.nMonth;
		if (nMonth == 12) {
			nMonth = 1;
			nYear = nYear + 1;
		} else {
			nMonth = nMonth + 1;
		}
		var htNextMonth = DateCoreAPI.getDateForLastDay(nYear, nMonth, 0, 1);
		return jindo.Calendar.isFuture(htNextMonth, this.htTodayDate) ? this.htTodayDate : htNextMonth;
	},

	hasFutureMonth : function(htDate) {
		return htDate.nYear < htTodayDate.nYear || ( htDate.nYear == htTodayDate.nYear && htDate.nMonth < htTodayDate.nMonth );
	}
});


shop.luckytoday2.catalog.WeekCalendar = new jindo.$Class({

	tWeekItem : jindo.$Template('<li class="week{=week} {=onOff}"><a href="#" class="_click[{=link}return false;]"><span class="tab_menu">{=week}주</span><span class="tab_day"><em>{=startMonth}</em>.<em>{=startDay}</em>-<em>{=endMonth}</em>.<em>{=endDay}</em></span></a><!--N=a:wbt.tab-->{=lastItem}</li>'),
	elWeekTab : null,
	elProductList : null,
	htTodayDate : null,

	$init : function(sWeekCalendarLayerId, htTodayDate, htServiceDate, sProductListId) {
		this.elWeekTab = jindo.$Element(sWeekCalendarLayerId);
		this.elProductList = jindo.$Element(sProductListId);
		this.htTodayDate = htTodayDate;
		this.initializeWeekTab(htServiceDate);
	},

	initializeWeekTab : function(htServiceDate) {
		var nWeek = shop.luckytoday2.catalog.Utility.countWeeksInMonth(htServiceDate);
		this.elWeekTab.addClass(this.getWeekTabClassName(nWeek));

		var htStartDate = shop.luckytoday2.catalog.Utility.getDateForMondayIndexInfo(htServiceDate, 1);
		var htEndDate = null;
		for (var i = 0; i < nWeek; i++) {
			htEndDate = jindo.Calendar.getRelativeDate(0, 0, 6, htStartDate);
			this.addWeekItem(this.getWeekHashTable(htServiceDate, htStartDate, htEndDate, i + 1, nWeek));
			htStartDate = jindo.Calendar.getRelativeDate(0, 0, 1, htEndDate);
		}
	},

	getWeekTabClassName : function(nWeek) {
		return nWeek == 4 ? "lucky_week_tab" : "lucky_week_tab2";
	},

	getWeekHashTable : function(htServiceDate, htStartDate, htEndDate, nCurrentWeek, nLastWeek) {
		var htWeekTab = {
			"week" : nCurrentWeek,
			"startMonth" : DateCoreAPI.getTwoDigit(htStartDate.nMonth),
			"startDay" : DateCoreAPI.getTwoDigit(htStartDate.nDate),
			"endMonth" : DateCoreAPI.getTwoDigit(htEndDate.nMonth),
			"endDay" : DateCoreAPI.getTwoDigit(htEndDate.nDate)	
		};

		if (this.htTodayDate.nMonth == htServiceDate.nMonth) {
			htServiceDate = jindo.Calendar.getRelativeDate(0, 0, -7, htServiceDate);
		}

		var sServiceYmd = DateCoreAPI.getCustomDateFormat(htStartDate, "yyyy-mm-dd");
		if (jindo.Calendar.isBetween(htServiceDate, htStartDate, htEndDate)) {
			htWeekTab.onOff = "on";
			this.requestBestProducts(sServiceYmd);
		}
		if (jindo.Calendar.isFuture(htStartDate, htServiceDate)) {
			htWeekTab.onOff = "off";
		} else {
			htWeekTab.link = "weekCalendar.selectWeekTab(" + nCurrentWeek + ", '" + sServiceYmd + "');";
		}
		if (nCurrentWeek == nLastWeek) {
			htWeekTab.lastItem = '<span class="bg_right"></span>';
		}

		return htWeekTab;
	},

	addWeekItem : function(htWeek) {
		this.elWeekTab.first().appendHTML(this.tWeekItem.process(htWeek));
	},

	selectWeekTab : function(nWeek, sServiceYmd) {
		var elWeeks = jindo.$ElementList(this.elWeekTab.first().child());
		for (var i = 0; i < elWeeks.length(); i++) {
			var elWeek = elWeeks.get(i);
			if (elWeek.hasClass("on")) {
				elWeek.removeClass("on");
			}
			if (nWeek == (i + 1)) {
				elWeek.addClass("on");
			}
		}
		this.requestBestProducts(sServiceYmd);
	},

	requestBestProducts : function(sServiceYmd) {
		var sUrl = "/luckytoday2/listBest.nhn";
		var oAjax = new jindo.$Ajax(sUrl, {
			type : 'xhr',
			method : 'post',
			onload : jindo.$Fn(this.onResponseSuccess, this).bind()
		});

		oAjax.request({ "serviceYmd" : sServiceYmd });
	},

	onResponseSuccess : function(response) {
		this.elProductList.html(response.text());
	}

});


shop.luckytoday2.catalog.EncoreHandler = new jindo.$Class({

	sUrl : null,

	$init : function(sUrl) {
		this.sUrl = sUrl;
	},

	requestEncore : function(nLkdyProdSeq) {
		var oAjax = new jindo.$Ajax(this.sUrl, {
			type : 'xhr',
			method : 'post',
			onload : jindo.$Fn(this.onResponseSuccess, this).bind()
		});

		oAjax.request({ "lkdyProdSeq" : nLkdyProdSeq });
	},

	onResponseSuccess : function(response) {
		var htResponse = response.json();
		console.log("response: " + htResponse);
		if (!htResponse.bSuccess) {
			var htReturnValue = htResponse.htReturnValue;
			var sErrorCode = htReturnValue.errorCode;
			if (sErrorCode == "NOT_LOGINED") {
				this.authorizePopup();
			} else if (sErrorCode == "FAIL") {
				alert(htReturnValue.msg);
			} else {
				alert(htReturnValue.msg);
			}
		} else {
			alert("신청되었습니다.");
		}
	},

	authorizePopup : function() {
		try {
			win = window.open("/luckytoday2/authorizePopup.nhn", "", "toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=250,height=300");
			win.moveTo(200, 100);
			win.focus();
		} catch(e) {
			console.log(e);
		}
		setTimeout(function() { jindo.$Window(win).sizeToContent(); }, 1000);
	}

});


shop.luckytoday2.main = new Object();

shop.luckytoday2.main.Timer = new jindo.$Class({
	endDate : null
	, divSeqNo : null

	, $init : function(endMilliSecond, divSeqNo) {
		this.endDate = new Date(endMilliSecond);
		this.divSeqNo = divSeqNo;
	}
	, changeTime : function() {
		var milliSecond = this.getDiffMilliSecond();
		var SEC = 1000;	
		var MIN = 60*SEC; 
		var HOUR = 60*MIN;
		var DAY = 24*HOUR;
		d = parseInt(milliSecond / DAY);
		milliSecond -= d * DAY;
		h = parseInt(milliSecond / HOUR);
		milliSecond -= h * HOUR;
		m = parseInt(milliSecond / MIN);
		milliSecond -= m * MIN;
		s = parseInt(milliSecond / SEC);
		
		var dd = "" + d;
		var dayLst = dd.split("");
		var dayStr = "";
		for (var cnt=0;cnt<dayLst.length;cnt++) {
			dayStr = dayStr +"<span class='lucky6_num lucky6_num"+dayLst[cnt]+"'>"+dayLst[cnt]+"</span>";
		}
		
		var hourLst = this.getTimeNumber(h);
		var hourStr = "";
		for (var cnt=0;cnt<hourLst.length;cnt++) {
			hourStr = hourStr + "<span class='lucky6_num lucky6_num"+hourLst[cnt]+"'>"+hourLst[cnt]+"</span>";
		}
		
		var minLst = this.getTimeNumber(m);
		var minStr = "";
		for (var cnt=0;cnt<minLst.length;cnt++) {
			minStr = minStr + "<span class='lucky6_num lucky6_num"+minLst[cnt]+"'>"+minLst[cnt]+"</span>";
		}
		
		var secLst = this.getTimeNumber(s);
		var secStr = "";
		for (var cnt=0;cnt<secLst.length;cnt++) {
			secStr = secStr + "<span class='lucky6_num lucky6_num"+secLst[cnt]+"'>"+secLst[cnt]+"</span>";
		}
		
		if (jindo.$Element("lucky_day"+this.divSeqNo) != null) {
			jindo.$Element("lucky_day"+this.divSeqNo).html(dayStr);
		}
		if (jindo.$Element("lucky_hour"+this.divSeqNo) != null) {
			jindo.$Element("lucky_hour"+this.divSeqNo).html(hourStr);
		}
		if (jindo.$Element("lucky_min"+this.divSeqNo) != null) {
			jindo.$Element("lucky_min"+this.divSeqNo).html(minStr);
		}
		if (jindo.$Element("lucky_sec"+this.divSeqNo) != null) {
			jindo.$Element("lucky_sec"+this.divSeqNo).html(secStr);
		}
	}
	, getDiffMilliSecond : function() {
		var diffMsec = this.endDate - new Date();
		return 0 < diffMsec ? diffMsec : 0;
	}
	, getTimeNumber : function(num) {
		var timeNum = (num < 10) ? "0" + num : ""+num;
		return timeNum.split("");
	}
});

shop.luckytoday2.main.Category = new jindo.$Class({
	preDivId : null,
	
	$init : function () {
		if (jindo.$("pre_select_category") != null) {
			this.preDivId = jindo.$("pre_select_category").value;
		}
	},
	
	ajaxRollList : function (divId, lkdyCatId, svcType) {
		var preLkdyProdSeq	=	jindo.$("pre_lkdy_prod_seq").value;
		var preDivId = this.preDivId;
		var ajaxObj = jindo.$Ajax("/luckytoday2/ajax_category.nhn?lkdyCatId="+lkdyCatId+"&svcType="+svcType+"&preLkdyProdSeq="+preLkdyProdSeq, {
			type : 'xhr',
			method : 'get',
			async : true,
			onload : function(res){
				if (res.status() == '200') {
					var sHTML = res._response.responseText;
					var aJS = [];
					var Exp = '<'+'script(\\s[^>]+)*>((.|\\n)*)</'+'script>';
					var replaceRegExp = new RegExp(Exp,'gi');				 
					var replaceFunction = function(_1, _2, sPart) {
						aJS.push(sPart);
						return '';
					};
					sHTML = sHTML.replace(replaceRegExp, replaceFunction);
					var targetElement  = jindo.$Element("product_list_roll");
					targetElement.empty();
					targetElement.html(sHTML);
					eval(aJS.join('\n'));
					jindo.$Element(preDivId).removeClass("on");
					jindo.$Element(divId).addClass("on");
				} else {
					alert("일시적으로 오류가 발생하였습니다.\n잠시 뒤에 다시 시도 해 주세요.");
				}
			}
		});
		ajaxObj.request();
		this.preDivId = divId;
	},
	
	ajaxProdInfo : function (lkdyProdSeq, prodCnt) {
		if (jindo.$Element("now_loading") != null) {
			jindo.$Element("now_loading").show();
		}
		var ajaxInfo = jindo.$Ajax("/luckytoday2/ajax_product.nhn?lkdyProdSeq="+lkdyProdSeq, {
			type : 'xhr',
			method : 'get',
			async : true,
			onload : function(res){
				if (res.status() == '200') {
					var sHtml = res._response.responseText;
					var aJS = [];
					var Exp = '<'+'script(\\s[^>]+)*>((.|\\n)*)</'+'script>';
					var replaceRegExp = new RegExp(Exp,'gi');				 
					var replaceFunction = function(_1, _2, sPart) {
						aJS.push(sPart);
						return true;
					};
					sHtml = sHtml.replace(replaceRegExp, replaceFunction);
					var targetInfo = jindo.$Element("product_info");
					targetInfo.empty();
					targetInfo.html(sHtml);
					eval(aJS.join('\n'));
				} else {
					alert("일시적인 오류가 발생하였습니다.\n잠시 뒤에 다시 시도 해 주세요.");
					return false;
				}
			}
		});
		var ajaxDetail = jindo.$Ajax("/luckytoday2/ajax_product_detail.nhn?lkdyProdSeq="+lkdyProdSeq, {
			type : 'xhr',
			method : 'get',
			async : true,
			onload : function(res){
				if (res.status() == '200') {
					var sHtml = res._response.responseText;
					var aJS = [];
					var Exp = '<'+'script(\\s[^>]+)*>((.|\\n)*)</'+'script>';
					var replaceRegExp = new RegExp(Exp,'gi');				 
					var replaceFunction = function(_1, _2, sPart) {
						aJS.push(sPart);
						return '';
					};
					sHtml = sHtml.replace(replaceRegExp, replaceFunction);
					var targetDetail = jindo.$Element("product_detail");
					targetDetail.empty();
					targetDetail.html(sHtml);
					eval(aJS.join('\n'));
				} else {
					alert("일시적인 오류가 발생하였습니다.\n잠시 뒤에 다시 시도 해 주세요.");
				}
			}
		});
		if (ajaxInfo.request()) {
			ajaxDetail.request();
		}
		var preProdCnt = Number(jindo.$("select_prod_cnt").value);
		if (preProdCnt > -1) {
			jindo.$Element("prod"+preProdCnt).removeClass("selected");
		}
		if (prodCnt > -1) {
			jindo.$Element("prod"+prodCnt).addClass("selected");
			jindo.$("select_prod_cnt").value = prodCnt;
		}
		if (jindo.$Element("now_loading") != null) {
			jindo.$Element("now_loading").hide();
		}
	},
	
	ajaxProdDetailContent : function (lkdyProdSeq) {
		var ajaxDetail = jindo.$Ajax("/luckytoday2/ajax_product_detail_content.nhn?lkdyProdSeq="+lkdyProdSeq, {
			type : 'xhr',
			method : 'get',
			async : true,
			onload : function(res){
				if (res.status() == '200') {
					var sHtml = res._response.responseText;
					var targetDetail = jindo.$Element("content");
					targetDetail.empty();
					targetDetail.html(sHtml);
					jindo.$Element("tab_product_detail").addClass("on");
					jindo.$Element("tab_product_comment").removeClass("on");
				} else {
					alert("일시적인 오류가 발생하였습니다.\n잠시 뒤에 다시 시도 해 주세요.");
				}
			}
		});
		ajaxDetail.request();
		if (jindo.$Element("aside_reply") != null) {
			jindo.$Element("aside_reply").show();
		}
	},
	
	viewPowerRcmdProduct : function (lkdyProdSeq) {
		this.powerRcmdRoll(lkdyProdSeq);
		this.ajaxProdInfo(lkdyProdSeq, -1);
	},
	
	powerRcmdRoll : function (lkdyProdSeq) {		var preDivId = this.preDivId;
		var ajaxObj = jindo.$Ajax("/luckytoday2/ajax_category.nhn?lkdyCatId=null&svcType=ALL_CATE&preLkdyProdSeq="+lkdyProdSeq, {
			type : 'xhr',
			method : 'get',
			async : true,
			onload : function(res){
				if (res.status() == '200') {
					var sHTML = res._response.responseText;
					var aJS = [];
					var Exp = '<'+'script(\\s[^>]+)*>((.|\\n)*)</'+'script>';
					var replaceRegExp = new RegExp(Exp,'gi');				 
					var replaceFunction = function(_1, _2, sPart) {
						aJS.push(sPart);
						return '';
					};
					sHTML = sHTML.replace(replaceRegExp, replaceFunction);
					var targetElement = jindo.$Element("product_list_roll");
					targetElement.empty();
					targetElement.html(sHTML);
					eval(aJS.join('\n'));
					jindo.$Element(preDivId).removeClass("on");
					jindo.$Element("all_category").addClass("on");
				} else {
					alert("일시적으로 오류가 발생하였습니다.\n잠시 뒤에 다시 시도 해 주세요.");
				}
			}
		});
		ajaxObj.request();
		this.preDivId = "all_category";
	}
});

shop.luckytoday2.main.Comment = new jindo.$Class({
	commentList : function (lkdyProdSeq, pageNo) {
		var ajaxObj = jindo.$Ajax("/luckytoday2/ajax_comment.nhn?lkdyProdSeq="+lkdyProdSeq+"&pageNo="+pageNo, {
			type : 'xhr',
			method : 'get',
			async : true,
			onload : function(res){
				if (res.status() == '200') {
					var sHTML = res._response.responseText;
					var targetElement = jindo.$Element("content");
					targetElement.empty();
					targetElement.html(sHTML);
					jindo.$Element("tab_product_detail").removeClass("on");
					jindo.$Element("tab_product_comment").addClass("on");
				} else {
					alert("일시적으로 오류가 발생하였습니다.\n잠시 뒤에 다시 시도 해 주세요.");
				}
			}
		});
		ajaxObj.request();
		if (jindo.$Element("aside_reply") != null) {
			jindo.$Element("aside_reply").hide();
		}
	},
	
	clearCommentBox : function(divId) {
		var comment = jindo.$(divId).value;
		if (comment.indexOf('오늘의 럭키투데이 상품에') == 0) {
			jindo.$("comment_box").value = "";
		}
	},
	
	checkMaxTxtLength : function(divId) {
		var comment = jindo.$(divId).value;
		if (comment.length > 300) {
			alert("최소 1자 이상, 최대 300자까지 작성 가능합니다.");
			jindo.$(divId).value = comment.substring(0, 300);
		}
	},
	
	checkMinTxtLength : function(divId) {
		var comment = jindo.$(divId).value;
		if (comment.trim().length < 1 || comment.indexOf('오늘의 럭키투데이 상품에') == 0) {
			alert("'럭투 상품 한마디'를 입력 해 주세요.\n최소 1자 이상, 최대 300자까지 작성 가능합니다.");
			return false;
		}
		return true;
	},
	
	writeComment : function(divId, pageNo, lkdyProdSeq, uprAwrdArtclSeq) {
		this.checkMaxTxtLength(divId);
		var params = {
			artclCont : jindo.$(divId).value,
			pageNo : pageNo,
			lkdyProdSeq : lkdyProdSeq,
			uprAwrdArtclSeq : uprAwrdArtclSeq
		};
		var ajaxObj = jindo.$Ajax("/luckytoday2/ajax_comment_write.nhn", {
			type : 'xhr',
			method : 'post',
			async : true,
			onload : function(res){
				if (res.status() == '200') {
					var sHTML = res._response.responseText;
					var targetElement = jindo.$Element("content");
					targetElement.empty();
					targetElement.html(sHTML);
					var totalCount = jindo.$("total_count").value;
					jindo.$Element("comment_count").html("("+totalCount+")");
				} else {
					alert("일시적으로 오류가 발생하였습니다.\n잠시 뒤에 다시 시도 해 주세요.");
				}
			}
		});
		if (this.checkMinTxtLength(divId)) {
			ajaxObj.request(params);
		}
	},
	
	viewReplyBox : function(divId) {
		jindo.$Element(divId).show();
	},
	
	deleteComment : function (awrdArtclSeq, lkdyProdSeq, mbrId, pageNo) {
		var ajaxObj = jindo.$Ajax("/luckytoday2/ajax_comment_delete.nhn?awrdArtclSeq="+awrdArtclSeq+"&mbrId="+mbrId+"&lkdyProdSeq="+lkdyProdSeq+"&pageNo="+pageNo, {
			type : 'xhr',
			method : 'get',
			async : true,
			onload : function(res){
				if (res.status() == '200') {
					var sHTML = res._response.responseText;
					var targetElement = jindo.$Element("content");
					targetElement.empty();
					targetElement.html(sHTML);
					var totalCount = jindo.$("total_count").value;
					jindo.$Element("comment_count").html("("+totalCount+")");
				} else {
					alert("일시적으로 오류가 발생하였습니다.\n잠시 뒤에 다시 시도 해 주세요.");
				}
			}
		});
		ajaxObj.request();
	},
	
	popupLogin : function (lkdyProdSeq) {
		alert("럭투 상품 한마디는 로그인 후 남기실 수 있습니다.");
		var url = jindo.$("home_url").value + "/returnProductPage.nhn?lkdyProdSeq="+lkdyProdSeq;
		//var returnUrl = 'http://nid.naver.com/nidlogin.login?mode=form&template=plogin&url=' + encodeURIComponent(url);
		var returnUrl = 'https://nid.naver.com/nidlogin.login?svctype=64&url=' + encodeURIComponent(url);
		window.open(returnUrl, '', 'width=400,height=350,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,top=100,left=100');
	}
});


shop.luckytoday2.main.Utility = new jindo.$Class({
	innerPopup : function (divId) {
		var view = document.getElementById(divId).style.display;
		if (view == 'block') {
			jindo.$Element(divId).hide();
		} else {
			jindo.$Element(divId).show();
		}
	},
	openSoldOutPopup : function (url) {
		alert("해당 상품은 품절 되었습니다.");
		window.open(url, '', '');
	}
});


*/